<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/commons/taglibs.jsp" %>
<%@ include file="/commons/script.jsp" %>
<script type="text/javascript" src="${ctx }/assets/js/pinyin_dict_notone.js"></script>
<script type="text/javascript" src="${ctx }/assets/js/pinyinUtil.js"></script>
<body>
<script>
jQuery(function($) {
	formvalidation("#addForm",{
		rules:{
			loginName:{
				remote:{
					url:"${ctx}/acctUser/json/checkUserExist",
					
				}
			}
		},
		
		messages:{
			loginName:{
				remote:"<fmt:message key='AcctUser.error.exist'/>"
			},
			confirmPassword:{
				equalTo:"<fmt:message key='AcctUser.error.confirmPassword'/>"
			}
		}
	})
	$("#saveBtn").click(function(){
		$("#addForm").submit();
	})
})
</script>
<fmt:message key="label.pleaseInput" var="pleaseInput"></fmt:message>
<fmt:message key="AcctUser.gender.title" var="genderTitle"/>
<fmt:message key="AcctUser.homePhone.title" var="homePhoneTitle"/>
<fmt:message key="AcctUser.lastLoginDate.title" var="lastLoginDateTitle"/>
<fmt:message key="AcctUser.loginName.title" var="loginNameTitle"/>
<fmt:message key="AcctUser.logo.title" var="logoTitle"/>
<fmt:message key="AcctUser.mobilePhone.title" var="mobilePhoneTitle"/>
<fmt:message key="AcctUser.password.title" var="passwordTitle"/>
<fmt:message key="AcctUser.confirmPassword.title" var="confirmPasswordTitle"/>
<fmt:message key="AcctUser.systemId.title" var="systemIdTitle"/>
<fmt:message key="AcctUser.userName.title" var="userNameTitle"/>
<fmt:message key="AcctUser.workPhone.title" var="workPhoneTitle"/>	
<fmt:message key="AcctUser.remarks.title" var="remarksTitle"/>	
<form:form action='${ctx}/acctUser/popup/save' id="addForm" name="addForm" modelAttribute="acctUser" method="post">
	<form:hidden path="id"/>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> <span class="required">*</span>
		${loginNameTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<c:if test="${acctUser.id == null }">			
			<form:input path="loginName" cssClass="form-control"  placeHolder='${pleaseInput} ${loginNameTitle}' maxlength='255' required='true'/>
			</c:if>
			<c:if test="${acctUser.id != null}">
			<c:out value="${acctUser.loginName }"></c:out>
			<form:hidden path="loginName"/>
			</c:if>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> <span class="required">*</span>
		${userNameTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:input path="userName" cssClass="form-control"  placeHolder='${pleaseInput} ${userNameTitle}' maxlength='250' required='true'/>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> <span class="required">*</span>
		${genderTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:select path="gender" cssClass="form-control">
				<form:options items="${genderMap }"/>
			</form:select>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${passwordTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:password path="password" cssClass="form-control required"  placeHolder='${pleaseInput} ${passwordTitle}' maxlength='255'/>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${confirmPasswordTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<input type="password" id="confirmPassword" name="confirmPassword" class="form-control required" placeHolder='${pleaseInput} ${confirmPasswordTitle}' equalTo="#password"/>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${homePhoneTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:input path="homePhone" cssClass="form-control"  placeHolder='${pleaseInput} ${homePhoneTitle}' maxlength='45'/>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${mobilePhoneTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:input path="mobilePhone" cssClass="form-control"  placeHolder='${pleaseInput} ${mobilePhoneTitle}' maxlength='45'/>
		</div>
	</div>	
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${systemIdTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<c:choose>
				<c:when test="${sessionScope['UserSessionInfo'].acctUser.systemId == null}">
					<form:select path="systemId" cssClass="form-control">
						<form:option value=""><fmt:message key="selection.label.pleaseselectone"></fmt:message> </form:option>
						<form:options items="${systemMap }" itemLabel="systemName"/>
					</form:select>
				</c:when>
				<c:otherwise>
					<c:set value="${sessionScope['UserSessionInfo'].acctUser.systemId}" var="systemId"></c:set>
					<c:out value="${systemMap[systemId].systemName }"></c:out>
					<form:hidden path="systemId"/>
				</c:otherwise>
			</c:choose>
			
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${workPhoneTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:input path="workPhone" cssClass="form-control"  placeHolder='${pleaseInput} ${workPhoneTitle}' maxlength='45'/>
		</div>
	</div>
	<div class="form-group">
		<label class="control-label col-md-2 col-xs-12 col-sm-2"> 
		${remarksTitle}
		</label>
		<div class="col-md-4 col-xs-12 col-sm-4">
			<form:textarea path="remarks" cssClass="form-control"  placeHolder='${pleaseInput} ${remarksTitle}' maxlength='65535' rows="3"/>
		</div>
	</div>
	<div class="form-group">	
			<div class="col-md-8 col-xs-12 col-xs-8">
				<a id="saveBtn" class="btn btn-primary"><fmt:message key="navigation.button.save"></fmt:message> </a>
				<a id="cancelBtn" class="btn btn-danger"  onclick="top.Dialog.close()"><fmt:message key="navigation.button.cancel"/></a>				
			</div>
	</div>
	<div id="afterupdate"></div>
</form:form>
</body>
